package Tencent;

import java.util.Scanner;

public class Main1 {

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		long x=scanner.nextInt();
		long y=scanner.nextInt();
		
		long n=(int)((Math.sqrt(1+8*x+8*y)-1)/2);
		
	    if(n*(n+1)/2!=(x+y))
	    {
	    	System.out.println(-1);
	    	return ;
	    }

	    long min=x;
	    
	    if(n>=min){
	    	System.out.println(1);
	    	return ;
	    }
	    long sum=0;
	    long counts=0;
	    for(long i=n;i>0;i--){
	    	sum+=i;
	    	counts++;
	    	if(sum<min) {
	    		continue;
	    	}
	    	System.out.println(counts);
	    	return ;
	    }	
	    scanner.close();

		
	}

}
